package cn.wrl.user.service.center;

import cn.wrl.user.pojo.Users;
import cn.wrl.user.pojo.bo.center.CenterUserBO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient("foodie-user-service")
@RequestMapping("center-user-api")
public interface CenterUserService {

    /**
     * 查询用户信息
     *
     * @param userId
     * @return
     */
    @GetMapping("user")
    Users queryUserInfo(@RequestParam("userId") String userId);

    /**
     * 修改用户信息
     *
     * @param userId
     * @param centerUserBO
     */
    @PutMapping("user/{userId}")
    Users updateUserInfo(@PathVariable("userId") String userId,
                         @RequestBody CenterUserBO centerUserBO);


    /**
     * 用户头像更新
     *
     * @param userId
     * @param faceUrl
     * @return
     */
    @PostMapping("updatePhoto")
    Users updateUserFace(@RequestParam("userId") String userId,
                         @RequestParam("faceUrl") String faceUrl);

    /**
     * 修改用户密码
     *
     * @param userId
     * @param oldPassword
     * @param newPassword
     */
    @PostMapping("updatePwd")
    Boolean updateUserPassword(@RequestParam("userId") String userId,
                               @RequestParam("oldPassword") String oldPassword,
                               @RequestParam("newPassword") String newPassword);
}
